#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;



struct item{
	int weight,value;
};



int main(){
	int t,m,ans=0x7fffffff;
	cin>>m>>t;
	item a[m];
	for(int i=0;i<m;i++)
		cin>>a[i].weight>>a[i].value;
	int h=t;
	t = (t/a[0].weight+1)*a[0].value;
	int dp[t+1];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=m;i++){
		for(int j=a[i-1].value;j<=t;j++){
			ans = min(ans,(dp[j] = max(dp[j],dp[j-a[i-1].value]+a[i-1].weight))>=h?j:0x7fffffff);
//			cout<<dp[j]<<" ";
		}
//		cout<<endl;
	}
	cout<<ans;
	return 0;
}
